package admin

import (
	"github.com/gin-gonic/gin"
	"fmt"
	"ju/src/models"
)

/**
登录
 */
func Login(c *gin.Context) {
	uname := c.PostForm("username")
	upwd := c.DefaultPostForm("password", "anonymous")

	c.SetCookie("uid", "uid", 3600, "", "", false, true)
	c.Writer.Header().Set("AuthToken", "asdcbasdcadscdcacd")
	fmt.Println(uname + "uname")
	fmt.Println(upwd + "upwd")
	c.Redirect(302, "/admin/index")
}

/**
注册
 */
func Register(c *gin.Context) {
	a := c.Query("a")
	b := c.Query("b")
	cc := c.Query("c")
	d := c.Query("d")
	roles := models.SelRoleByName()
	var br models.BaseReturn
	br.Code = 0
	br.Msg = "请求成功"
	br.Data = roles
	fmt.Println(a)
	fmt.Println(b)
	fmt.Println(cc)
	fmt.Println(d)
	c.JSON(200, br)
}

/**
忘记密码
 */
func ForgetPwd(c *gin.Context) {
	a := c.PostForm("a")
	b := c.PostForm("b")
	cc := c.PostForm("c")
	d := c.PostForm("d")
	fmt.Println("postdata")
	fmt.Println(a)
	fmt.Println(b)
	fmt.Println(cc)
	fmt.Println(d)
	c.JSON(200, gin.H{
		"message": "pong",
	})
}

/**
获取用户信息
 */
func GetUserInfo() {

}
